<#assign content>
<div class="right_col" role="main">
    <div class="">
        <div class="page-title">
            <div class="title_left">
                <h3>密码列表</h3>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2><small></small></h2>
                        <ul class="nav navbar-right panel_toolbox">
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <form id="editPassSelfForm" method="post" novalidate class="form-horizontal form-label-left">
                        <p class="text-muted font-13 m-b-30"></p>
                            <div class="item form-group">
                                <label class="control-label col-md-3">密码<span class="required">*</span>
                                </label>
                                <div class="col-md-6">
                                    <input type="password" id="password" name="password" required="required" data-validate-length-range="6,12"
                                           pattern="alphanumeric" placeholder="请输入密码" class="form-control col-md-6">
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3">确认密码<span class="required">*</span>
                                </label>
                                <div class="col-md-6">
                                    <input type="password" id="confirmpass" name="confirmpass" required="required" data-validate-length-range="6,12"
                                           data-validate-linked="password" pattern="alphanumeric" placeholder="请再次输入密码" class="form-control col-md-6">
                                </div>
                            </div>
                            <div class="ln_solid"></div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-3">
                                    <button id="editpassword" type="button" class="btn btn-success">保存</button>
                                    <button class="btn btn-primary" type="reset">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</#assign>
<#include "../_inc/layout.ftl" />
<script>

    $(document).ready(function() {

        // 提交保存
        $('#editpassword').on('click', function () {
            if(validator.checkAll($('#editPassSelfForm'))) {
                var param = {};
                param.action = 'doEdit';
                param.password = $('#password').val();
                param.confirmpass = $('#confirmpass').val();

                $.ajax({
                    type: 'POST',
                    url: '/edit_password_self.do',
                    cache: false,
                    dataType: 'json',
                    data: param,
                    success: function(result) {
                        $.promptModal('${warning}', result.msg);
                        $('#prompt').on('hide.bs.modal', function () {
                            location.reload();
                        });
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        $.promptModal('${warning}', '${systemException}');
                    }
                });
            }
        });
    });

</script>

